package com.geeguo.ebuilder.core.redis.utils;

import org.apache.commons.lang3.ArrayUtils;

public abstract class AbstractCacheKeyFactory {

    protected abstract String getApplicationName();

    protected String genK(String... keys) {
        String[] newKeys = ArrayUtils.insert(0, keys, getApplicationName());
        return String.join(":", newKeys);
    }

    public String getCaptcha(String id) {
        return genK("CAPTCHA", id);
    }

    public String getLoginUser(String loginKey) {
        return genK("LOGIN_USER", loginKey);
    }
}
